using System;
using System.Windows.Forms;
using System.Drawing;
using System.Collections.Generic;
using System.Threading;
using System.IO;
using System.ComponentModel;

[System.ComponentModel.DesignerCategory("Code")]
public class CreatorDialog : Form
{
    public IContainer components = null;
    public ComboBox comboBox1;
    public ButtonOK btnOK;
    public Button btnCancel;
    public Label label1;
    public ComboBox comboBox2;
    public NumericUpDown spinnerThreads;
    Label lblThreads;
    private Label label2;
    public RadioButton radioButton1;
    public RadioButton radioButton2;
    private GroupBox groupBox1;
    public List<FileSystemInfo> files;

    private class LabelThreads : Label
    {
        public LabelThreads() : base()
        {
            Text = "Threads:";
            Location = new Point(10, 220);
        }
    }

    private class LabelArchief : Label
    {
        public LabelArchief() : base()
        {
            AutoSize = true;
            Location = new Point(29, 15);
            Name = "label1";
            Size = new Size(75, 13);
            TabIndex = 4;
            Text = "Archive name:";
        }
    }

    private class LabelCompressie : Label
    {
        public LabelCompressie() : base()
        {
            AutoSize = true;
            Location = new Point(29, 77);
            Name = "label2";
            Size = new Size(64, 13);
            TabIndex = 6;
            Text = "Compressie:";
        }
    }

    private class ComboBoxCompressionType : ComboBox
    {
        public ComboBoxCompressionType() : base()
        {
            DropDownStyle = ComboBoxStyle.DropDownList;
            FormattingEnabled = true;
            Items.AddRange(new object[] { "Geen", "GZip", "DNGS" });
            Location = new Point(32, 93);
            Name = "comboBox2";
            Size = new Size(121, 21);
            TabIndex = 5;
        }
    }

    private class SpinnerThreads : NumericUpDown
    {
        public SpinnerThreads() : base()
        {
            Location = new Point(100, 220);
            Value = 8;
        }
    }

    private class GroupBoxProcessor : GroupBox
    {
        public GroupBoxProcessor() : base()
        {
            Location = new Point(30, 132);
            Name = "groupBox1";
            Size = new Size(189, 58);
            TabIndex = 9;
            TabStop = false;
            Text = "Processor";
        }
    }

    public class ButtonOK : Button
    {
        public bool Clicked { get; set; }

        public ButtonOK() : base()
        {
            Location = new Point(30, 255);
            Name = "btnOK";
            Size = new System.Drawing.Size(75, 23);
            TabIndex = 2;
            Text = "OK";
            UseVisualStyleBackColor = true;
        }
    }

    public class ButtonCancel : Button
    {
        public ButtonCancel() : base()
        {
            Location = new Point(147, 255);
            Name = "btnCancel";
            Size = new Size(75, 23);
            TabIndex = 3;
            Text = "Cancel";
            UseVisualStyleBackColor = true;
        }
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
            components.Dispose();
        
        base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
        comboBox1 = new ComboBox();
        btnOK = new ButtonOK();
        btnCancel = new ButtonCancel();
        label1 = new LabelArchief();
        comboBox2 = new ComboBoxCompressionType();
        label2 = new LabelCompressie();
        radioButton1 = new RadioButton();
        radioButton2 = new RadioButton();
        groupBox1 = new GroupBoxProcessor();
        spinnerThreads = new SpinnerThreads();
        lblThreads = new LabelThreads();
        groupBox1.SuspendLayout();
        SuspendLayout();
        comboBox1.FormattingEnabled = true;
        comboBox1.Location = new Point(32, 31);
        comboBox1.Name = "comboBox1";
        comboBox1.Size = new Size(121, 21);
        comboBox1.TabIndex = 0;
        btnOK.Click += new EventHandler(button1_Click);
        btnCancel.Click += new EventHandler(button2_Click);
        this.radioButton1.AutoSize = true;
        this.radioButton1.Location = new System.Drawing.Point(9, 27);
        this.radioButton1.Name = "radioButton1";
        this.radioButton1.Size = new System.Drawing.Size(54, 17);
        this.radioButton1.TabIndex = 7;
        this.radioButton1.TabStop = true;
        this.radioButton1.Text = "Single";
        this.radioButton1.UseVisualStyleBackColor = true;
        
        this.radioButton2.AutoSize = true;
        this.radioButton2.Checked = true;
        this.radioButton2.Location = new System.Drawing.Point(97, 27);
        this.radioButton2.Name = "radioButton2";
        this.radioButton2.Size = new System.Drawing.Size(47, 17);
        this.radioButton2.TabIndex = 8;
        this.radioButton2.TabStop = true;
        this.radioButton2.Text = "Multi";
        this.radioButton2.UseVisualStyleBackColor = true;
        
        groupBox1.Controls.Add(radioButton1);
        groupBox1.Controls.Add(radioButton2);
        
        AcceptButton = this.btnOK;
        ClientSize = new Size(280, 280);
        Controls.Add(groupBox1);
        Controls.Add(label2);
        Controls.Add(comboBox2);
        Controls.Add(btnOK);
        Controls.Add(label1);
        Controls.Add(btnCancel);
        Controls.Add(comboBox1);
        Controls.Add(spinnerThreads);
        Controls.Add(lblThreads);

        Name = "CreatorDialog";
        Text = "Add to Archive";
        groupBox1.ResumeLayout(false);
        groupBox1.PerformLayout();
        ResumeLayout(false);
        PerformLayout();
    }

    public CreatorDialog()
    {   
        InitializeComponent();
        files = new List<FileSystemInfo>();
        comboBox2.SelectedIndex = 0;
    }

    public void setFileList(List<FileSystemInfo> selectedList)
    {
        this.files = selectedList;
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Close();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        btnOK.Clicked = true;
        Close();
    }
}
